package com.kmzx.one.project.mapper;

import com.github.pagehelper.Page;
import com.kmzx.one.project.entity.AttributeValues;
import com.kmzx.one.project.entity.AttributeWithCategory;
import com.kmzx.one.project.entity.Product;
import com.kmzx.one.project.entity.ProductAttribute;
import com.kmzx.one.project.entity.ProductAttributeValues;
import com.kmzx.one.project.entity.ProductDiscount;
import com.kmzx.one.project.entity.TemporaryPic;
import com.kmzx.one.project.others.common.FeeData;
import com.kmzx.one.project.others.common.IdAndKinds;
import com.kmzx.one.project.others.common.PrivilegesUserData;
import com.kmzx.one.project.others.common.TwoData;
import com.kmzx.one.project.others.dso.ProdCatePriceDso;
import com.kmzx.one.project.others.dso.ProdJoinAttributeCategory;
import com.kmzx.one.project.others.dso.ProdJoinAttributeWithCategory;
import com.kmzx.one.project.others.dso.ProdJoinDiscount;
import com.kmzx.one.project.others.dso.ProductExtraInfo;
import com.kmzx.one.project.others.dto.FastProdInfo;
import com.kmzx.one.project.others.dto.FastProdMainInfo;
import com.kmzx.one.project.others.dto.GreatBrand;
import com.kmzx.one.project.others.dto.MemberActionInfo;
import com.kmzx.one.project.others.dto.ProdCateOutInfo;
import com.kmzx.one.project.others.dto.ProdOutInfo;
import com.kmzx.one.project.others.dto.ProdSkuTaxReq;
import com.kmzx.one.project.others.dto.ProductActivityGoods;
import com.kmzx.one.project.others.dto.StraightInfo;
import com.kmzx.one.project.others.dto.TempActiveInfo;
import com.kmzx.one.project.others.dto.WareHouseInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface ProductMapper {

    // 查找所有的商品分类
    List<ProdCateOutInfo> selectCateAll();

    List<ProdCateOutInfo> selectCateByRankId(@Param("rankId") String rankId);

    // 由类别id查找商品
    Page<ProdOutInfo> selectProdByCateIdPager(String cateId);

    Page<ProdOutInfo> selectProdByCateIdPager2(String cateId);

    Page<ProdOutInfo> selectProdByCateIdPager3(List<String> list);

    Page<ProdOutInfo> selectProdByCateIdPager4();

    // 由商品id查找最小的价格
    BigDecimal selectProdGroupPrice(String prodId);

    // 由商品id 列表查找最小的价格
    List<ProdCatePriceDso> selectProdGroupPriceList(List<String> list);

    // 查找商品的属性信息
    List<ProdJoinAttributeCategory> selectProdEntryInfo(String productId);

    // 查找商品,主键查找
    Product selectProdById(String id);

    // 查找商品的属性以及属性值
    AttributeWithCategory selectAttributeWithCategoryById(String id);

    // 查找商品的图片,由id和kinds
    List<IdAndKinds> selectProdPicsByProdId(String productId);

    // 查找商品的属性信息2
    List<ProdJoinAttributeWithCategory> selectProdEntryInfo2(String productId);

    // 查找商品的属性信息2
    List<ProdJoinAttributeWithCategory> selectProdSKUEntryInfo(String skuId);

    // 查找商品的打折信息

    // 查找商品的物流费
    Map<String, BigDecimal> selectProductFreeFee();

    // 查找商品的属性值
    List<AttributeValues> selectAttributeValuesByValueLists(@Param("list") List<String> list);

    // 查找商品的属性
    List<ProductAttribute> selectProductAttributeLists(@Param("list") List<String> list);

    // 查找商品的属性值键值对
    List<ProductAttributeValues> selectProductAttributeValuesLists(@Param("list") List<String> list);

    // 查找sku详细信息
    List<AttributeWithCategory> selectOptionIdAndValueKeys(String attributeCategoryId);

    List<AttributeWithCategory> selectAttributePrice(List<String> list);

    List<ProductAttributeValues> selectProdNamesByAllIds(List<String> list);

    List<ProductDiscount> selectProductDiscount(@Param("productId") String productId);

    List<ProductDiscount> selectProductDiscountList(List<String> list);

    Integer selectProdAttributeStoreId3(@Param("prodId") String prodId);

    List<WareHouseInfo> selectProdStore(@Param("productId") String productId);

    List<WareHouseInfo> selectProdStoreAvg(@Param("productId") String productId);


    List<WareHouseInfo> selectProdStoreNum(@Param("productId") String productId, @Param("tradeNum") String tradeNum);

    List<WareHouseInfo> selectProdStoreNumLimit(@Param("productId") String productId, @Param("tradeNum") String tradeNum);

    List<WareHouseInfo> selectProdAttributeStore(List<String> list);

    List<WareHouseInfo> selectProdAttributeStoreTradeNum(@Param("skuId") String skuId, @Param("tradeNum") String tradeNum);

    Integer selectProdAttributeStoreId2(@Param("skuId") String skuId);

    List<ProductExtraInfo> selectProdExtraInfo(@Param("prodId") String prodId);

    List<ProductExtraInfo> selectProdExtraInfoList(List<String> list);

    // 批量查找商品的图片
    List<TwoData> selectProductCoverImg(List<String> list);

    Map<String, String> selectProductCoverImgMap(List<String> list);

    List<PrivilegesUserData> selectProdAttributeStoreId4(List<String> list);


    List<String> selectHasUserPrivileges();

    /*
    找 商品的最小成本价
     */
    BigDecimal findProductSpecificMinPrice(String productId);

    String findProductSpecificMinPriceAs(String productId);

    /*
    找 商品 sku的最小成本价
     */
    BigDecimal findSkuSpecificMinPrice(String skuId);

    /*
     批量找 商品 sku的最小成本价
    */
    List<PrivilegesUserData> selectSkuSpecificMinPriceList(List<String> list);

    /*
    查找商品的 费用信息
     */
    List<FeeData> selectProductFeeData();

    /*
   查找商品的 费用信息
    */
    List<FeeData> selectProductFeeData2();

    // 商品的打折率
    List<ProdJoinDiscount> selectAllProductJoinDiscount();

    // 商品的打折率
    List<ProdJoinDiscount> selectProductJoinDiscount(@Param("prodId") String prodId);

    // 商品的打折率
    List<ProdJoinDiscount> selectProductsJoinDiscount(@Param("list") List<String> list);

    // sku的打折率
    List<ProdJoinDiscount> selectProductSkuJoinDiscount(@Param("list") List<String> list);

    // sku的打折率
    List<ProdJoinDiscount> selectProductSkuOneJoinDiscount(@Param("skuId") String skuId);

    // 查找商品的直升列表商品
    List<MemberActionInfo> selectProductStraight();

    // 商品直升信息
    StraightInfo selectStraightInfoById(String id);

    StraightInfo selectStraightInfoById2(Integer level);

    FastProdMainInfo selectFastProdMainInfo(String prodId);

    Page<FastProdInfo> selectFastProdInfoPaged(String fastId);

    List<StraightInfo> selectAllStraightInfo();

    List<FastProdInfo> selectFastProdInfoPagedList(List<String> list);

    List<FastProdInfo> selectFastProdInfoPagedList2();

    // 由商品id,获取所属的直升品类
    List<Map<String, Object>> selectProdFastKind(@Param("prodId") String prodId, @Param("rankNo") Integer rankNo);

    BigDecimal selectFastProdBySku(@Param("skuId") String skuId);

    Integer selectFastGradeBySkuId(String skuId);

    List<GreatBrand> selectAllGreatBrandList(String userId);

    List<String> findProdCategory(@Param("prodId") String prodId);

    int checkProdIsFast(@Param("prodId") String prodId);


    List<TempActiveInfo> selectTempActivity();

    List<String> findProdRankIds(@Param("prodId") String prodId);

    ProductAttributeValues selectProductAttributeValuesById(String id);

    int checkIsFastProd(@Param("prod") String prod);

    // 查看商品的额外费率
    ProdSkuTaxReq selectProdTaxExtra(@Param("prodId") String prodId);

    String selectProdSpedUnit(@Param("prodProfiles") String prodProfiles);

    List<TemporaryPic> selectTemporaryPic();

    List<ProductActivityGoods> selectProductActivityGoods();

    List<ProductActivityGoods> selectProductSaleActivityGoods();

    List<String> selectAllTempPicIds();

    List<String> selectAllTempProdIds();

    List<ProdCatePriceDso> selectSKUGroupPriceList(List<String> list);

}
